
const G_BASE_URL = "https://6925c48g05.vicp.fun"; // 本地内网映射到花生壳的域名

const http = {
	post: function(url, reqData) {
		return new Promise((resolve, reject) => {
			console.log("################ request ##################");
			console.log("请求url: " + G_BASE_URL + url);
			console.log("请求reqData: " + JSON.stringify(reqData));
			console.log("################ request ##################");
			uni.request({
			    url: G_BASE_URL + url, //仅为示例，并非真实接口地址。
			    data: reqData,
			    header: {},
				method: "POST",
			    success: (res) => {
					if(res.data && res.data.code == 1){
						resolve(res.data.data)
					} else {
						uni.showToast({
							title: '接口请求失败: ' + (res.msg ? res.msg : '系统错误'),
							duration: 2000,
							icon: "none"
						});
					}
				
			    },
				fail: (err) => {
					uni.showToast({
						title: '接口请求失败: ' + err,
						icon: "none",
						duration: 2000
					});
				}
			});
		})
	},
	
	get: function() {}
}


export default http